package com.yangzb.spring.batch;

import com.zaxxer.hikari.HikariDataSource;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;

import javax.sql.DataSource;

public class DataSourceUtils {
    public static DataSource create(DataSourceProperties dataSourceProperties){
        dataSourceProperties.setDriverClassName("com.mysql.jdbc.Driver");
        HikariDataSource dataSource = dataSourceProperties.initializeDataSourceBuilder()
                .type(HikariDataSource.class).build();
        return dataSource;
    }
}
